﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.Linq;

public partial class Finance_CreateCalculations : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        //KonturDataContext db = new KonturDataContext();
        ItemsDataContext db = new ItemsDataContext();

        var p = from c in db.Legs select c;

        RadGrid1.DataSource = p;
        RadGrid1.DataBind();

        //double<> c_exw1, d_exw2, e_exw3;

        //foreach (var element in p)
        //{
        //    c_exw1 = (double)element.EXW1;
        //    e_exw3 = (double)element.EXW3;
        //    d_exw2 = (double)element.EXW2;

        //}


        // create the object to be inserted
        CalcData data = new CalcData()
        {
            
            D = null,
            E = 5
        };


        // Insert
        try
        {
            db.CalcDatas.InsertOnSubmit(data);
            db.SubmitChanges();
        }
        catch (ChangeConflictException)
        {
            db.ChangeConflicts.ResolveAll(RefreshMode.KeepChanges);
        }

   

    }
}
